﻿<div class="form-horizontal" ms-controller="TSGL">
    <div style="margin: 0 80px;">
        <div>
            <!--<div class="fg-item"><span>基本信息</span></div>-->
            <ul class="clearfix" style="display: block;padding:0">
                <li class="add-item add-width fl-left">
                    <label class="add-item-label"><i>*</i>图书编码</label>
                    <div class="add-ic">
                        <input id="conNR" ms-duplex="modelData.TSNum" class="form-control szhl_require" maxlength="400" />
                    </div>
                </li>
                <li class="add-item add-width fl-right">
                    <label class="add-item-label"><i>*</i>图书类型</label>
                    <div class="add-ic">
                        <select name="conType" id="conType" ms-duplex="modelData.TSType" class="form-control">
                            <option ms-repeat-item="ColumnData" ms-attr-value="item.ID" ms-attr-selected="item.ID==modelData.TSType?'selected':''">{{item.TypeName}}</option>
                        </select>
                    </div>
                </li>
                <li class="add-item add-width fl-left">
                    <label class="add-item-label"><i>*</i>名称</label>
                    <div class="add-ic">
                        <input id="conNR" ms-duplex="modelData.TSName" class="form-control szhl_require " maxlength="400" />
                    </div>
                </li>
                <li class="add-item add-width fl-right">
                    <label class="add-item-label">购买年月</label>
                    <div class="add-ic">
                        <input type="text" ms-duplex="modelData.BuyDate" class="form-control szhl_form_date_mon" maxlength="50" />
                    </div>
                </li>
                <li class="add-item add-width fl-left">
                    <label class="add-item-label"><i>*</i>可用状态</label>
                    <div class="add-ic">
                        <select ms-duplex-selected="modelData.Status" class="form-control">
                            <option value="0">可用</option>
                            <option value="1">不可用</option>
                        </select>
                    </div>
                </li>
                <li class="add-item add-width fl-right">
                    <label class="add-item-label">作者</label>
                    <div class="add-ic">
                        <input type="text" ms-duplex="modelData.auther" class="form-control" maxlength="50" />
                    </div>
                </li>
                <li class="add-item add-width fl-left">
                    <label class="add-item-label">出版社</label>
                    <div class="add-ic">
                        <input type="text" ms-duplex="modelData.cbs" class="form-control" maxlength="50" />
                    </div>
                </li>
                <li class="add-item add-width fl-right">
                    <label class="add-item-label">版次</label>
                    <div class="add-ic">
                        <input type="text" ms-duplex="modelData.bc" class="form-control" maxlength="50" />
                    </div>
                </li>
                <li class="add-item add-width fl-left">
                    <label class="add-item-label">购买价格(单位:元)</label>
                    <div class="add-ic">
                        <input type="text" ms-duplex="modelData.Price" class="form-control" maxlength="50" />
                    </div>
                </li>
                <li class="add-item add-width fl-right">
                    <label class="add-item-label">在馆数量</label>
                    <div class="add-ic">
                        <input type="text" ms-duplex="modelData.SL" class="form-control" maxlength="50" />
                    </div>
                </li>
                <li class="add-item add-widthall">
                    <label class="add-item-label">图书封面</label>
                    <div class="add-ic">
                        <input type="text" ms-duplex="modelData.Files" class="span2  szhl_Upload form-control" />
                    </div>
                </li>
            </ul>
        </div>
    </div>

</div>
<script>
    var tempmodel = avalon.define({
        $id: "TSGL",
        name: "图书管理",
        ColumnData: [],
        iswf: false,//是否属于流程表单
        inittemp: function (strId) {
            $.getJSON('/API/VIEWAPI.ashx?Action=XTGL_GETZIDIANLIST', { P1: 24 }, function (resultData) {
                if (resultData.ErrorMsg == "") {
                    tempmodel.ColumnData = resultData.Result;
                    if (!tempmodel.modelData.TSType && resultData.Result.length > 0) {
                        tempmodel.modelData.TSType = resultData.Result[0].ID
                    };
                }
            })
            if (strId) {
                //编辑加载数据
                $.getJSON('/API/VIEWAPI.ashx?Action=JYGL_GETTSINFO', { P1: strId }, function (resultData) {
                    if (resultData.ErrorMsg == "") {
                        tempmodel.modelData = resultData.Result;
                        setTimeout(" ComFunJS.initForm()", 500)
                    }
                })
            } else {
                ComFunJS.initForm();
            }
        },//初始化
        modelData: { "TSNum": "", "TSType": "", "TSName": "", "BuyDate": "", "Price": "", "auther": "", "Status": 0, "Files": "", "TSTypeName": "", "SL": "1", "bc": "", "cbs": "", "jystatus": "0" },
        SaveData: function (callback) {
            tempmodel.modelData.TSTypeName = $("#conType").find("option:selected").text();
            $.post("/API/VIEWAPI.ashx?ACTION=JYGL_ADDTSINFO", { P1: JSON.stringify(tempmodel.modelData.$model) }, function (result) {
                return callback.call(this,result);
            });
        }

    });
</script>
